<template>
  <div class="app-container">
    <!-- 搜索区域 -->
    <div class="search-container">
      <SmForm
        ref="queryFormRef"
        :inline="true"
        label-width="150px"
        v-model="queryParams"
        :options="searchFormOptions"
        :getModelValue="getSearchFormData"
      >
        <template #action>
          <el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
          <el-button icon="refresh" @click="handleResetQuery">重置</el-button>
        </template>
      </SmForm>
    </div>

    <el-card shadow="hover" class="data-table">
      <SmTable
        isSelection
        border
        :loading="loading"
        :options="tableOptions"
        :data="list"
        :total="total"
        v-model:currentPage="queryParams.pageNum"
        v-model:pageSize="queryParams.pageSize"
        @pagination="getList"
      ></SmTable>
    </el-card>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: "Log",
  inheritAttrs: false,
});

import { useSearchForm } from "./hooks/search";
// import LogAPI, { LogPageVO, LogPageQuery } from "@/api/system/log-api";
import { useTable } from "./hooks/useTable";

const {
  tableOptions,
  list,
  total,
  loading,
  queryParams,
  getList,
  handleQuery,
  handleResetQuery,
  queryFormRef,
  formRef,
  openForm,
} = useTable();

const { getSearchFormData, searchFormOptions } = useSearchForm(handleQuery, queryParams);

onMounted(() => {
  getList();
  // handleQuery();
});
</script>
